package com.demo.member;

import com.demo.AppletConstant;
import com.demo.util.Utils;

import java.util.HashMap;
import java.util.Map;

public class updateCardTemplate {

    public static void main(String[] args) {

        String resultStr = updateCardTemplate();

        System.out.println("-------创建小程序会员卡模板:"+resultStr+"---------");

    }

    public static String updateCardTemplate(){
        //调用地址
        String url = "https://open.95516.com/open/access/1.0/updateCardTemplate";
        //拼装参数Map
        Map params = new HashMap<String, String>(0);
        params.put("appId", AppletConstant.APP_ID);
        params.put("backendToken", AppletConstant.backendToken);

        Map<String,Object> appInfo = new HashMap<>();
        appInfo.put("appId","");
        appInfo.put("type","");
        appInfo.put("perm","");
        appInfo.put("extraData","");
        appInfo.put("isFinish","");
        appInfo.put("scenarioId","");

        Map<String,Object> jumpInfo = new HashMap<>();
        jumpInfo.put("innerHtml","");
        jumpInfo.put("appInfo",appInfo);

        Map<String,Object> dateInformation = new HashMap<>();
        dateInformation.put("type","");
        dateInformation.put("availableBeginTime","");
        dateInformation.put("availableEndTime","");
        dateInformation.put("availableDayAfterReceive","");

        Map<String,Object> levelInformation = new HashMap<>();
        levelInformation.put("initLevel","");
        levelInformation.put("levelValueWord","");
        levelInformation.put("levelUrl","");
        levelInformation.put("jumpInfo",jumpInfo);

        Map<String,Object> balanceInformation = new HashMap<>();
        balanceInformation.put("initBalance","");
        balanceInformation.put("balanceValueWord","");
        balanceInformation.put("balanceUrl","");
        balanceInformation.put("jumpInfo",jumpInfo);

        Map<String,Object> bonus = new HashMap<>();
        bonus.put("initBonus","");
        bonus.put("bonusValueWord","");
        bonus.put("bonusUrl","");
        bonus.put("jumpInfo",jumpInfo);

        Map<String,Object> center = new HashMap<>();
        center.put("centerTitleType","");

        Map<String,Object> customCell = new HashMap<>();
        customCell.put("name","");
        customCell.put("tips","");
        customCell.put("url","");
        customCell.put("jumpInfo",jumpInfo);

        Map<String,Object> centerBtn = new HashMap<>();
        centerBtn.put("btnType","");
        centerBtn.put("btnTitle","");
        centerBtn.put("btnSubTitle","");
        centerBtn.put("jumpInfo",jumpInfo);

        Map<String,Object> customBtn = new HashMap<>();
        customBtn.put("btnTitle","");
        customBtn.put("btnValue","");
        customBtn.put("jumpInfo",jumpInfo);

        Map<String,Object> reqData = new HashMap<>();
        reqData.put("cardTemplateId","");
        reqData.put("appletId",AppletConstant.APPLET_ID);
        reqData.put("logoUrl","");
        reqData.put("title","");
        reqData.put("backgroundPictureUrl","");
        reqData.put("description","");
        reqData.put("servicePhone","");
        reqData.put("codeType","");
        reqData.put("dateInformation",dateInformation);
        reqData.put("codeMode","");
        reqData.put("needDisplayLevel","");
        reqData.put("levelInformation",levelInformation);
        reqData.put("outRequestNo","");
        reqData.put("needBalance","");
        reqData.put("balanceInformation",balanceInformation);
        reqData.put("cardType","");
        reqData.put("cardSubType","");
        reqData.put("showBonus","");
        reqData.put("bonus",bonus);
        reqData.put("url","");
        reqData.put("showCenter","");
        reqData.put("center",center);
        reqData.put("centerBtn",centerBtn);
        reqData.put("customCell",customCell);
        reqData.put("customBtn",customBtn);

        params.put("reqData", reqData);

        System.out.println("生成入参和签名："+params);
        //发送请求
        String resultStr = Utils.sendPostGson(url, params);
        return resultStr;
    }

}
